#include "vector_float.h"


vector_float::vector_float()
{
	this->vptr = nullptr;
	this->size = 0;
}

vector_float::vector_float(int s)
{
	this->create_vector(s);
}


vector_float::~vector_float()
{
	delete[] this->vptr;
}

void vector_float::create_vector(int s){
	this->vptr = new float [s];
	this->size = s;
}

void vector_float::print(){
	cout << "[";
	for (int i = 0; i < this->size; i++)
	{
		if (i > 0){ cout << ", "; }
		cout << this->vptr[i];
	}
	cout << "]" << endl;
}

void vector_float::set(float value, int index){
	if (index < this->size){
		this->vptr[index] = value;
	}
}

void vector_float::read_from_keyboard(){
	for (int i = 0; i < this->size; i++)
	{
		cout << "Ange flyttal nummer " << i + 1 << ": ";
		cin >> this->vptr[i];
	}
}